package com.yundasys.lab02springbootstudy.registrar;

import com.yundasys.lab02springbootstudy.annotation.MyMapper;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.core.type.filter.AnnotationTypeFilter;

import java.util.Set;

/**
 * @author jiangta
 * @version 1.0
 * @date 2021/2/2 5:18 下午
 */
public class MyMapperBeanDefinitionScanner extends ClassPathBeanDefinitionScanner {

    public MyMapperBeanDefinitionScanner(BeanDefinitionRegistry registry, boolean useDefaultFilters) {
        super(registry, useDefaultFilters);
    }

    protected void registerFilters() {
        addIncludeFilter(new AnnotationTypeFilter(MyMapper.class));
    }


    @Override
    protected Set<BeanDefinitionHolder> doScan(String... basePackages) {
        return super.doScan(basePackages);
    }
}
